import Vue from 'vue';
import VueRouter, {RouteConfig} from 'vue-router';

import Money from '@/views/Money.vue';
import Labels from '@/views/Labels.vue';
import Statistics from '@/views/Statistics.vue';
import EditLabel from '@/views/EditLabel.vue'
import NotFound from '@/views/NotFound.vue';
Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
    {
        path: '/',
        redirect: '/money'
        //重定向
    }
    ,
    {
        path: '/money',
        name: 'money',
        component: Money
    },
    {
        path:'/labels',
        name: 'labels',
        component: Labels,
    },
    {
        path: '/statistics',
        name: 'statistics',
        component: Statistics,
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    },
    {
        path:'/labels/edit/:id',
        name: 'editLabel',
        component: EditLabel,
    },
    {
        path:'*',
        component: NotFound,
    }
];

const router = new VueRouter({
    routes
});

export default router;
